home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / vuCollect 1.1 / vuCollect < prev    next >
Encoding:
Text File  |  1993-09-17  |  3.8 KB  |  147 lines  |  [TEXT/MPS ]

  1.  
  2. #----------------------------------------------------------------------------
  3. #    
  4. #    NAME
  5. #        vuCollect -- Reformat Descriptor window information to a readable 
  6. #                     multi-line format.
  7. #
  8. #    VERSION:  1.1
  9. #    
  10. #    SYNOPSIS
  11. #            
  12. #        vuCollect -t "TargetName" [-d "DescriptorTrait"] 
  13. #        
  14. #    AUTHOR    Ken Landreth 974-1110  MS 35-BD
  15. #    
  16. #    DESCRIPTION
  17. #        vuCollect is an MPW script which calls Virtual User for the specified target,
  18. #        collects descriptor information, and then pipes that output to an MPW tool
  19. #        "vuFormatter" which in turn converts the descriptor information to a 
  20. #        multi-line format instead of the single-line format normally given by VU.
  21. #        This structured format makes the descriptor information very readable and is
  22. #        also handy for documenting various information about an application and its
  23. #        corresponding VU scripts.
  24. #
  25. #        The default descriptor trait used is "window"; however using the -d command,
  26. #        the user can specify whatever descriptor trait he/she wishes.  (e.g.:
  27. #
  28. #                    vucollect -t "*:myTarget" -d "menu" > myFile
  29. #
  30. #        would specify to output to "myFile" the menu descriptors for myTarget machine
  31. #        in a readable multi-line format.
  32. #        
  33. #        vuCollect must have "VU" and the secondary tool "vuFormatter" accessible;
  34. #        therefore you should place all three files in the MPW Tools folder or in a 
  35. #        folder which is accessible to your current working directory.
  36. #        
  37. #        vuCollect makes use of the VU menu script (if installed - see VU docs) 
  38. #        and its associated default variables for zones, targets, etc.  After
  39. #        "Pick Target" is selected from VU menu, you could simply type:
  40. #
  41. #                            vucollect
  42. #
  43. #        vuFormatter will output window descriptors with additional information
  44. #        about descriptors' sizes and relative location within each window.
  45. #        See 'ReadMe' file.
  46. #    
  47. #    HISTORY    06/26/90    - Created.
  48. #            08/22/90    - Take out output file option.
  49. #                        - vu optional output to "vuCollectTemp"
  50. #                        - Redirect vu Err/output to "Dev:Null".
  51. #            08/24/90    - Added support for VU menu and default variables.
  52. #                        - Delete need for one temporary file.
  53. #            02/20/91    - Allow for single quotes in chooser name.
  54. #            02/21/92    - Fixed small vu return error handling problem.
  55. #
  56. #    COPYRIGHT
  57. #          Copyright Apple Computer, Inc. 1990
  58. #            All rights reserved.
  59. #    
  60. #-----------------------------------------------------------------------------
  61.  
  62.  
  63.  
  64. set cmd            "{0}"
  65. set desTypeFlag    0
  66. set desTypeOpt    0
  67. set desType        "window"
  68. set targetFlag    0
  69. set targetOpt    0
  70. set vuArgs        ""
  71. set usage        '# Usage: vuCollect -t TargetName ∂[-d DescriptorSpec∂].'
  72.  
  73.  
  74. # process parameters
  75. for Parm in {"Parameters"}
  76.     if {targetFlag}
  77.         if "{Parm}" =~ /-≈/
  78.             echo "# -t option used without target name."
  79.             echo {usage}
  80.             exit 1
  81.         else 
  82.             set targetFlag 0
  83.             set targetOpt 1
  84.             set vuArgs "{vuArgs} -t ∂"{Parm}∂""
  85.         end
  86.  
  87.     else if {desTypeFlag}
  88.         if "{Parm}" =~ /-≈/    
  89.             echo "# -d option used without Descriptor type."
  90.             echo {usage}
  91.             exit 1
  92.         else 
  93.             set desTypeFlag 0
  94.             set desTypeOpt    1
  95.             set desType "{Parm}"
  96.         end
  97.         
  98.     else if "{Parm}" =~ /-t/
  99.         set targetFlag 1
  100.     
  101.     else if "{Parm}" =~ /-d/
  102.         set desTypeFlag 1
  103.         
  104.     else if "{Parm}" =~ /-≈/
  105.         echo "# invalid option ∂'{Parm}∂'."
  106.         echo {usage}
  107.         exit 1
  108.     end
  109. end
  110.  
  111.  
  112. if {desTypeFlag}
  113.     echo "# -d option used without Descriptor type."
  114.     echo {usage}
  115.     exit 1
  116.  
  117. else if {targetFlag}
  118.     echo "# -t option used without target name."
  119.     echo {usage}
  120.     exit 1
  121.     
  122. else if !{targetOpt}
  123.     if "{VUTargetName}" == ""
  124.         echo "# -t option required to specify target."
  125.         echo {usage}
  126.         exit 1
  127.     else 
  128.         set vuArgs "{vuArgs} -t '{VUTargetZone}:{VUTargetName}'"
  129.     end
  130. end
  131.  
  132. set TempScript     "{MPW}vuCollectScript.vu"
  133. set TempResults    "{MPW}vuCollectResults"
  134.         
  135. if {status} == 0
  136.     echo "println collect[{desType}];" > "{TempScript}"
  137.     vu  {vuArgs} -s "{TempScript}" -o "{TempResults}" 
  138.     vuFormatter "{TempResults}"
  139.     delete -y "{TempScript}"
  140.     delete -y "{TempResults}"
  141. else
  142.     delete -y "{TempScript}"
  143.     delete -y "{TempResults}"
  144.     exit 1
  145. end
  146.  
  147.